<?php

set_time_limit(0);
include '../../../common.inc.php';
// 开始处理时间: 03-21:13:30
//exit();
if (!isset($start)) {
	$start =0;
}
var_dump($start);
if (!isset($end)) {
	exit('please insert $end 的 值!');
} else {
	$end = intval($end);
}
var_dump($end);
$dbm=new db_mysqli();
$dbm->connect('192.168.1.19', 'root', 'root', 'manual', 0, 'utf8');
$dbm->pre = '';
$dbm->query('set names utf8');
$sql = "select * from manual where id>$start and id<=$end order by ID ASC limit 100 ";
//var_dump($sql);exit();
$arr = $dbm->get_all($sql);
if (!$arr) {
	exit('Handle in:"'.$start. '", Handle Over!');
}
foreach($arr as $k => $v) {
	if ($v['info']) {
		$sql = "insert into xd_manual(title, catid)values ('{$v['tit']}','{$v['cate']}')";
		$db->query($sql);
		$iid = $db->insertId();
		$sql = "insert into xd_manual_data(itemid, content) values({$iid}, '{$v['info']}')";
		$db->query($sql);
	} else {
		$start = $v['ID'];
		continue;
	}
	$start = $v['ID'];
}

echo  '<meta http-equiv="refresh" content="1; url='.$_SERVER['PHP_SELF'].'?start='.$start.'&end='.$end.'" />';



function isDelete($rs) {
	if (trim($rs['info'])) {
		return false;
	} else {
		return true;
	}
}